package org.loong.crypto.core.params;

import org.loong.crypto.core.Parameters;

/**
 * The parameters to key generator.
 */
public class KeyPairGeneratorParameters implements Parameters {

    /**
     * The key size.
     */
    private int keySize;

    /**
     * no args constructor.
     */
    public KeyPairGeneratorParameters() {}

    /**
     * builder constructor.
     *
     * @param builder builder
     */
    private KeyPairGeneratorParameters(final Builder builder) {
        this.keySize = builder.keySize;
    }

    /**
     * class builder.
     *
     * @return builder
     */
    public static Builder builder() {
        return new Builder();
    }

    /**
     * Gets the value of keySize.
     *
     * @return the value of keySize
     */
    public int getKeySize() {
        return keySize;
    }

    /**
     * Sets the keySize.
     *
     * @param keySize the keySize to set
     */
    public void setKeySize(final int keySize) {
        this.keySize = keySize;
    }

    /**
     * class builder.
     */
    public static final class Builder {

        private int keySize = -1;

        /**
         * no args constructor.
         */
        private Builder() {}

        /**
         * build new Object.
         *
         * @return this
         */
        public KeyPairGeneratorParameters build() {
            return new KeyPairGeneratorParameters(this);
        }

        /**
         * build keySize.
         *
         * @param keySize keySize
         * @return this
         */
        public Builder keySize(final int keySize) {
            this.keySize = keySize;
            return this;
        }
    }
}
